#define _CRT_SECURE_NO_WARNINGS 1


#include<iostream>
using namespace std;
int main()
{
	int l, n;
	cin >> l >> n;
	int count = n;
	while (count--)
	{
		int L;
		int coun = 0;
		cin >> L;
		int y = l;
		int t = l;
		while (1)
		{
			if ((2 * y - 150) < L)
			{
				coun++;
				t = 2 * y - 150;
				y = t;
			}
			else if ((2 * y - 150) > L)
			{
				coun = -1;
				break;
			}
			else
			{
				coun++;
				break;
			}
		}
		cout << coun << '\n';
	}
	return 0;
}